package com.eostoken.eos_wallet.net.common;

import com.blankj.utilcode.util.ObjectUtils;
import com.blankj.utilcode.util.SPUtils;
import com.eostoken.eos_wallet.utils.Constants;

import static com.eostoken.eos_wallet.utils.Constants.AYING_TEST_URL_EOS;
import static com.eostoken.eos_wallet.utils.Constants.AYING_URL_EOS;
import static com.eostoken.eos_wallet.utils.Constants.CORPORATION_URL;
import static com.eostoken.eos_wallet.utils.Constants.GUOYU_TEST_URL;
import static com.eostoken.eos_wallet.utils.Constants.GUOYU_URL;
import static com.eostoken.eos_wallet.utils.Constants.OFFICIAL_URL_EOS;
import static com.eostoken.eos_wallet.utils.Constants.PRODUCT_URL;
import static com.eostoken.eos_wallet.utils.Constants.TESTURL;
import static com.eostoken.eos_wallet.utils.Constants.TESTURL_EOS;
import static com.eostoken.eos_wallet.utils.Constants.TEST_URL;
import static com.eostoken.eos_wallet.utils.Constants.TEST_URL_EOS;
import static com.eostoken.eos_wallet.utils.Constants.URL_EOS;

public class BaseUrlUtils {

    public static String getEOSBaseUrl() {
        String serverName = SPUtils.getInstance(Constants.SP_MangoWallet_info).getString(Constants.KEY_EOS_SERVER, OFFICIAL_URL_EOS);
        if (ObjectUtils.equals(serverName, OFFICIAL_URL_EOS)) {
            return URL_EOS;
        } else if (ObjectUtils.equals(serverName, TESTURL_EOS)) {
            return TEST_URL_EOS;
        } else if (ObjectUtils.equals(serverName, AYING_URL_EOS)) {
            return AYING_TEST_URL_EOS;
        } else {
            return URL_EOS;
        }
    }

    public static String getCompanyBaseUrl() {
        String serverName = SPUtils.getInstance(Constants.SP_MangoWallet_info).getString(Constants.KEY_SERVER, CORPORATION_URL);
        if (ObjectUtils.equals(serverName, CORPORATION_URL)) {
            return PRODUCT_URL;
        } else if (ObjectUtils.equals(serverName, TESTURL)) {
            return TEST_URL;
        } else if (ObjectUtils.equals(serverName, GUOYU_URL)) {
            return GUOYU_TEST_URL;
        } else {
            return PRODUCT_URL;
        }
    }
}
